<template>
  <div class="newlist">
    <van-card
      v-for="item in newslist"
      :key="item.id"
      :title="item.title"
      :thumb="item.img_url"
      @click="goInfo(item.id)"
    >
      <div slot="price">
        2020-8-4 10:11:29
      </div>
      <div slot="num">
        点击1次
      </div>
    </van-card>
  </div>
</template>
<script>
export default {
  data: () => ({
    newslist: []
  }),
  created() {
    this.getNewsList()
  },
  methods: {
    async getNewsList() {
      try {
        const { data: { message } } = await this.Api.getNewsList()
        this.newslist = message
      } catch (error) {
        this.$Toast('请求错误。。。')
      }
    },
    goInfo(id) {
      this.$router.push('/home/newsinfo/' + id)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
